Google Analytics is a free, comprehensive tool that allows you to track your web traffic and data.
Google Analytics will show you how many people visit your site, individual pages, conversions, and how visitors interact with your content. This data is crucial for optimizing your website.
There are two types of Google Analytics codes.
You may be familiar with the Google Universal Analytics (UA) code. This is being phased out and replaced with Google Analytics 4 (GA4).
GA4 is much more customizable and applicable to websites or apps, whereas Google UA can only be applied to websites.
Setting Up Google Analytics On Your Website
The first thing you need to do is set up your free Google Analytics account.
You will be prompted to sign in with a Gmail account. Once you’ve done that, click the button that says Start Measuring.
The next screen will ask you to create an account name. You can track more than one site under one account, so you might want to use something broad, such as the name of your business.
Next, set up properties. This should include the name of your website, the time zone, and the currency used for your business’s location.
The next screen will ask a few questions about your business and how you intend to use Google Analytics.
Agree to the terms and select email communications, then you will be taken to the admin dashboard.
Next, you will want to set up the data stream.
When adding Google Analytics to a WordPress site, select “web stream.”
Add your site’s URL and the site’s name.
Once you hit the Create Stream button, you will see the stream name, stream URL, stream ID, and measurement ID.
The measurement ID is what you will use to add to your website.
Adding Google Analytics To Your WordPress Website
There are three different ways to add Google Analytics to any WordPress site.
The best option for you will depend on your comfort level with making changes to your website code.
- Using a WordPress Plugin
The easiest way to add your Google Analytics tag code to WordPress is with a plugin, such as Google Analytics for WordPress by MonsterInsights. The free version should work fine unless you want advanced tracking and reporting features.
Steps:
- Install and activate the MonsterInsights plugin.
- Launch the Wizard to fill in details about your site and hit the Connect MonsterInsights button.
- Sign into your Gmail account and give permission.
- Complete the connection to your Google Analytics account.
- You’re all set up and will see Insights in your WordPress dashboard.
- Using The Header/Footer Script Plugin
Another method to install your Google Analytics tag is with a header/footer plugin like WPCode Insert Headers and Footers + Custom Code Snippets. This method is helpful if you want to track different metrics for different pages.
Steps:
- Install the Headers and Footers plugin on your WordPress site.
- In your Google Analytics account, click on Tagging Instructions and select the Install Manually tab.
- Copy the Google Tag code.
- In your WordPress dashboard, navigate to the Code Snippets plugin, select Header & Footer, and paste your code into the header section.
- Save changes.
To add code to a specific page or post, select the page or post, scroll to the bottom, add the appropriate Google Analytics code in the header section, and hit Update to save changes.
- Add Google Analytics Code Snippet Directly To The Header.php File
If you are comfortable working directly in your theme code, this is an option too. Note that changing the theme will require re-adding your Google Analytics code.
Steps:
- In the WordPress dashboard, go to Appearance > Theme File Editor.
- Select the parent theme and open header.php.
- Copy and paste the code right before the closing tag.
- Click Update File to save your changes.
Verifying Your Google Analytics Tags
Once your Google Analytics tag is installed, use the Tag Assistant (Legacy) Chrome Extension to verify its installation.
Once Google Analytics Is Installed On Your WordPress Site
After installing your Google Analytics tag, view the dashboard through the Google Analytics site or, if using the MonsterInsight plugin, directly from your WordPress dashboard.
Google Analytics offers valuable insights into how visitors are getting to and using your website, how well pages are converting, and more.
Adding the Google Analytics tag to a WordPress site is straightforward with these methods:
- Google Analytics plugin (such as MonsterInsights).
- Header/Footer plugin (such as WPCode).
- Direct addition to the theme header.php file.
Using Google Analytics data will allow you to improve your website’s performance. Remember, Google Analytics cannot collect data retrospectively. Add it to your site sooner rather than later to ensure you don’t miss any data.
More resources:
- Google Tag Manager: A GA4 Beginner’s Guide
- 11 Google Analytics Reports You Might Not Know About
- 13 Best Chrome Extensions for Digital Marketing and SEO
Featured Image: Andrey_Popov/Shutterstock